<?php

if(!defined('_HTML_FORM_')) {
define('_HTML_FORM_', 1);

function itstock_html_form_input_text($label, $name ,$value, $placeholder, $attrs = '', $type = 'text') {
  printf('<tr><td><label>%s</label></td><td><input type="%s" name="%s" value="%s" placeholder="%s" %s></td></tr>',
    $label, $type, $name, $value, $placeholder, $attrs);
}

function itstock_html_form_checkbox($label, $name ,$checked, $attrs = '') {
  printf('<tr><td><label>%1$s:</label></td>
    <td><input type="hidden" name="%2$s" value="0">
    <input type="checkbox" name="%2$s" value="1" %3$s %4$s></td></tr>',
    $label, $name, ($checked? 'checked' :''), $attrs);
}

function itstock_html_form_open($type, $id, $class = 'save') {
  printf('<form class="%1$s" action="store.php?type=%2$s" method="POST" id="form_%2$s" autocomplete="off">
    <input type="hidden" value="%3$s" id="id" name="id"><table>',
    $class, $type, $id);
}

function itstock_html_form_close() {
  ?><tr>
      <td>&nbsp;</td>
      <td><br><input type="submit" value="Save" style="margin-right: 100px;"><input type="reset" value="Reset"></td>
    </tr>
  </table>
</form><?php
}

}
